package com.muyu.logbackdemo.controller;

import com.muyu.logbackdemo.entity.ResponseEntity;
import com.muyu.logbackdemo.entity.UserEntity;
import com.muyu.logbackdemo.result.ResultResponse;
import com.muyu.logbackdemo.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: UserController
 * @Author: Zirun.Xin
 * @Date: 2025/3/19 下午4:22
 * @Version: 1.0
 * @Description: 用户控制层
 */
@RestController
@RequiredArgsConstructor
@Api(tags = {"用户模块"})
@RequestMapping(value = "/api/v1/user")
public class UserController {

    /**
     * 用户业务层
     */
    private final UserService userService;

    /**
     * 获取用户信息
     * @return 响应结果集
     */
    @GetMapping(value = "/get-list")
    @ApiOperation(value = "获取用户信息", notes = "查询用户所有信息")
    public ResponseEntity<ResultResponse<List<UserEntity>>> getUserList() {
        List<UserEntity> userList = userService.getUserList();
        return ResponseEntity.ok(ResultResponse.ok(userList, "查询成功！"));
    }
}
